Integrand size = 28, antiderivative size = 80 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=-\frac {a \text {arctanh}(\sin (c+d x))}{b^2 d}-\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{b^2 d}+\frac {\sec (c+d x)}{b d} \]
-a*arctanh(sin(d*x+c))/b^2/d+sec(d*x+c)/b/d-arctanh((b*cos(d*x+c)-a*sin(d* x+c))/(a^2+b^2)^(1/2))*(a^2+b^2)^(1/2)/b^2/d
Time = 0.11 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.36 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {2 \sqrt {a^2+b^2} \text {arctanh}\left (\frac {-b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2+b^2}}\right )+a \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+b \sec (c+d x)}{b^2 d} \]
(2*Sqrt[a^2 + b^2]*ArcTanh[(-b + a*Tan[(c + d*x)/2])/Sqrt[a^2 + b^2]] + a* (Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) + b*Sec[c + d*x])/(b^2*d)
Time = 0.39 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3042, 3583, 3042, 3553, 219, 4257}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\cos (c+d x)^2 (a \cos (c+d x)+b \sin (c+d x))}dx\) |
\(\Big \downarrow \) 3583 |
\(\displaystyle \frac {\left (a^2+b^2\right ) \int \frac {1}{a \cos (c+d x)+b \sin (c+d x)}dx}{b^2}-\frac {a \int \sec (c+d x)dx}{b^2}+\frac {\sec (c+d x)}{b d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\left (a^2+b^2\right ) \int \frac {1}{a \cos (c+d x)+b \sin (c+d x)}dx}{b^2}-\frac {a \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{b^2}+\frac {\sec (c+d x)}{b d}\) |
\(\Big \downarrow \) 3553 |
\(\displaystyle -\frac {\left (a^2+b^2\right ) \int \frac {1}{a^2+b^2-(b \cos (c+d x)-a \sin (c+d x))^2}d(b \cos (c+d x)-a \sin (c+d x))}{b^2 d}-\frac {a \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{b^2}+\frac {\sec (c+d x)}{b d}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle -\frac {a \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{b^2}-\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{b^2 d}+\frac {\sec (c+d x)}{b d}\) |
\(\Big \downarrow \) 4257 |
\(\displaystyle -\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{b^2 d}-\frac {a \text {arctanh}(\sin (c+d x))}{b^2 d}+\frac {\sec (c+d x)}{b d}\) |
-((a*ArcTanh[Sin[c + d*x]])/(b^2*d)) - (Sqrt[a^2 + b^2]*ArcTanh[(b*Cos[c + d*x] - a*Sin[c + d*x])/Sqrt[a^2 + b^2]])/(b^2*d) + Sec[c + d*x]/(b*d)
3.2.17.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt Q[a, 0] || LtQ[b, 0])
Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x _Symbol] :> Simp[-d^(-1) Subst[Int[1/(a^2 + b^2 - x^2), x], x, b*Cos[c + d*x] - a*Sin[c + d*x]], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]
Int[cos[(c_.) + (d_.)*(x_)]^(m_)/(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin [(c_.) + (d_.)*(x_)]), x_Symbol] :> Simp[-Cos[c + d*x]^(m + 1)/(b*d*(m + 1) ), x] + (-Simp[a/b^2 Int[Cos[c + d*x]^(m + 1), x], x] + Simp[(a^2 + b^2)/ b^2 Int[Cos[c + d*x]^(m + 2)/(a*Cos[c + d*x] + b*Sin[c + d*x]), x], x]) / ; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Time = 0.71 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.61
method | result | size |
derivativedivides | \(\frac {\frac {1}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-a^{2}-b^{2}\right ) \operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{b^{2} \sqrt {a^{2}+b^{2}}}-\frac {1}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}}{d}\) | \(129\) |
default | \(\frac {\frac {1}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-a^{2}-b^{2}\right ) \operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{b^{2} \sqrt {a^{2}+b^{2}}}-\frac {1}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}}{d}\) | \(129\) |
risch | \(\frac {2 \,{\mathrm e}^{i \left (d x +c \right )}}{d b \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{b^{2} d}-\frac {a \ln \left (i+{\mathrm e}^{i \left (d x +c \right )}\right )}{b^{2} d}+\frac {\sqrt {a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a -b}{\sqrt {a^{2}+b^{2}}}\right )}{d \,b^{2}}-\frac {\sqrt {a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a -b}{\sqrt {a^{2}+b^{2}}}\right )}{d \,b^{2}}\) | \(167\) |
1/d*(1/b/(tan(1/2*d*x+1/2*c)+1)-a/b^2*ln(tan(1/2*d*x+1/2*c)+1)-2/b^2*(-a^2 -b^2)/(a^2+b^2)^(1/2)*arctanh(1/2*(2*a*tan(1/2*d*x+1/2*c)-2*b)/(a^2+b^2)^( 1/2))-1/b/(tan(1/2*d*x+1/2*c)-1)+a/b^2*ln(tan(1/2*d*x+1/2*c)-1))
Leaf count of result is larger than twice the leaf count of optimal. 191 vs. \(2 (76) = 152\).
Time = 0.28 (sec) , antiderivative size = 191, normalized size of antiderivative = 2.39 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=-\frac {a \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - a \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) - \sqrt {a^{2} + b^{2}} \cos \left (d x + c\right ) \log \left (-\frac {2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right ) - 2 \, b}{2 \, b^{2} d \cos \left (d x + c\right )} \]
-1/2*(a*cos(d*x + c)*log(sin(d*x + c) + 1) - a*cos(d*x + c)*log(-sin(d*x + c) + 1) - sqrt(a^2 + b^2)*cos(d*x + c)*log(-(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 - 2*a^2 - b^2 + 2*sqrt(a^2 + b^2)*(b*cos( d*x + c) - a*sin(d*x + c)))/(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2) *cos(d*x + c)^2 + b^2)) - 2*b)/(b^2*d*cos(d*x + c))
\[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=\int \frac {\sec ^{2}{\left (c + d x \right )}}{a \cos {\left (c + d x \right )} + b \sin {\left (c + d x \right )}}\, dx \]
Leaf count of result is larger than twice the leaf count of optimal. 163 vs. \(2 (76) = 152\).
Time = 0.32 (sec) , antiderivative size = 163, normalized size of antiderivative = 2.04 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=-\frac {\frac {a \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{b^{2}} - \frac {a \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{b^{2}} + \frac {\sqrt {a^{2} + b^{2}} \log \left (\frac {b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{b^{2}} - \frac {2}{b - \frac {b \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}}{d} \]
-(a*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/b^2 - a*log(sin(d*x + c)/(cos (d*x + c) + 1) - 1)/b^2 + sqrt(a^2 + b^2)*log((b - a*sin(d*x + c)/(cos(d*x + c) + 1) + sqrt(a^2 + b^2))/(b - a*sin(d*x + c)/(cos(d*x + c) + 1) - sqr t(a^2 + b^2)))/b^2 - 2/(b - b*sin(d*x + c)^2/(cos(d*x + c) + 1)^2))/d
Time = 0.35 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.70 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=-\frac {\frac {a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{2}} - \frac {a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{2}} + \frac {\sqrt {a^{2} + b^{2}} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{b^{2}} + \frac {2}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} b}}{d} \]
-(a*log(abs(tan(1/2*d*x + 1/2*c) + 1))/b^2 - a*log(abs(tan(1/2*d*x + 1/2*c ) - 1))/b^2 + sqrt(a^2 + b^2)*log(abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b - 2*s qrt(a^2 + b^2))/abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b + 2*sqrt(a^2 + b^2)))/b ^2 + 2/((tan(1/2*d*x + 1/2*c)^2 - 1)*b))/d
Time = 22.73 (sec) , antiderivative size = 310, normalized size of antiderivative = 3.88 \[ \int \frac {\sec ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx=\frac {2\,\mathrm {atanh}\left (\frac {64\,a^2\,\sqrt {a^2+b^2}}{64\,a^2\,b+\frac {64\,a^4}{b}+128\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+128\,a\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {128\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2+b^2}}{64\,a^2+\frac {64\,a^4}{b^2}+\frac {128\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{b}+128\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {64\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2+b^2}}{64\,a^4+128\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^3\,b+64\,a^2\,b^2+128\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b^3}\right )\,\sqrt {a^2+b^2}}{b^2\,d}-\frac {2\,a\,\mathrm {atanh}\left (\frac {64\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^2+\frac {64\,a^4}{b^2}}+\frac {64\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^4+64\,a^2\,b^2}\right )}{b^2\,d}-\frac {2}{b\,d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]
(2*atanh((64*a^2*(a^2 + b^2)^(1/2))/(64*a^2*b + (64*a^4)/b + 128*a^3*tan(c /2 + (d*x)/2) + 128*a*b^2*tan(c/2 + (d*x)/2)) + (128*a*tan(c/2 + (d*x)/2)* (a^2 + b^2)^(1/2))/(64*a^2 + (64*a^4)/b^2 + (128*a^3*tan(c/2 + (d*x)/2))/b + 128*a*b*tan(c/2 + (d*x)/2)) + (64*a^3*tan(c/2 + (d*x)/2)*(a^2 + b^2)^(1 /2))/(64*a^4 + 64*a^2*b^2 + 128*a*b^3*tan(c/2 + (d*x)/2) + 128*a^3*b*tan(c /2 + (d*x)/2)))*(a^2 + b^2)^(1/2))/(b^2*d) - (2*a*atanh((64*a^2*tan(c/2 + (d*x)/2))/(64*a^2 + (64*a^4)/b^2) + (64*a^4*tan(c/2 + (d*x)/2))/(64*a^4 + 64*a^2*b^2)))/(b^2*d) - 2/(b*d*(tan(c/2 + (d*x)/2)^2 - 1))